<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
class CacheFinder extends DAO_Finder {
    
    static function cacheResult($sql, $model='Admin') {
        $conn = ConnectionManager::getConn(call_user_func(array($model, 'getConn')));
        $arr    = array();
        $table = call_user_func(array($model, 'getTableName'), $arr);
        $rs = $conn->query($sql, $arr);
        $return = array();
        while ($data = $rs->fetch()) {
            $m = new $model;
            foreach ($data as $key => $d) {
                call_user_func(array($m, 'set'.$key), $d);
            }
            $m->setNew(false);
            $return[] = $m;
        }
        return $return;
    }
}
?>
